/*
 * Copyright (C) 2016 - present Instructure, Inc.
 *
 * This file is part of Canvas.
 *
 * Canvas is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License as published by the Free
 * Software Foundation, version 3 of the License.
 *
 * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Affero General Public License along
 * with this program. If not, see <http://www.gnu.org/licenses/>.
 */

$te-active-theme-bg: $ic-color-success;
$te-hovered-theme-bg: darken($ic-bg-light-neutral, 7%);
$te-light-on-dark-bg-text: darken($ic-color-light, 15%);

.ic-ThemeCard {
  box-sizing: border-box;
  position: relative;
  flex: 0 0 264px;
  margin: 0 $ic-sp/2 $ic-sp*3;
  background: $ic-color-light;
  border: 1px solid $ic-border-light;
  box-shadow: 0 0 8px rgba(black, 0.1);
  overflow: hidden;

  &.ic-ThemeCard--is-active-theme {
    background: $te-active-theme-bg;
    border-color: $te-active-theme-bg;
    box-shadow: 0 0 0 4px $ic-color-success, 0 0 8px 4px rgba(black, 0.15);
  }
}

.ic-ThemeCard-thumbnail {
  height: 132px;
  position: relative;
  box-sizing: border-box;
  padding: $ic-sp $ic-sp $ic-sp $ic-sp*4;
  display: flex;
  overflow: hidden;
  user-select: none;
  background: $ic-color-light;
  cursor: pointer;

  .ic-ThemeCard-overlay {
    opacity: 0;
  }
  &:hover {
    .ic-ThemeCard-overlay {
      opacity: 1;
    }
  }

}

.ic-ThemeCard-thumbnail__primary-content {
  box-sizing: border-box;
  flex: 0.66;
  padding-right: $ic-sp*2;
}

.ic-ThemeCard-thumbnail__secondary-content {
  box-sizing: border-box;
  flex: 0.34;
}

.ic-ThemeCard-thumbnail__nav {
  height: 100%; width: $ic-sp*3;
  position: absolute;
  top: 0; left: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.ic-ThemeCard-thumbnail__icon {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  svg {
    display: block;
    width: 16px; height: 16px;
  }
}

.ic-ThemeCard-thumbnail__icon-text {
  width: 50%;
  height: 2px;
  margin-top: 4px;
  box-sizing: border-box;
}

.ic-ThemeCard-fake-text {
  position: relative;
  height: 38px;
  width: 100%;
  box-shadow:
    inset 0 2px 0 $ic-border-light,
    inset 0 6px 0 $ic-color-light,
    inset 0 8px 0 $ic-border-light,
    inset 0 12px 0 $ic-color-light,
    inset 0 14px 0 $ic-border-light,
    inset 0 18px 0 $ic-color-light,
    inset 0 20px 0 $ic-border-light,
    inset 0 24px 0 $ic-color-light,
    inset 0 26px 0 $ic-border-light,
    inset 0 30px 0 $ic-color-light,
    inset 0 32px 0 $ic-border-light,
    inset 0 36px 0 $ic-color-light,
    inset 0 38px 0 $ic-border-light;
  margin-bottom: 10px;
  &:after {
    content: "";
    height: 3px; width: 34%;
    background: $ic-color-light;
    position: absolute;
    bottom: 0; right: 0;
  }
}

.ic-ThemeCard-fake-button {
  box-sizing: border-box;
  width: 100%; height: 14px;
  border: 1px solid rgba(black, 0.18);
  border-radius: $baseBorderRadius;
  margin-bottom: $ic-sp/2;
}

.ic-ThemeCard-fake-progressbar {
  box-sizing: border-box;
  width: 100%; height: 10px;
  border-width: 1px; border-style: solid;
  border-radius: $baseBorderRadius;
  position: relative;
  margin-bottom: $ic-sp;
}

.ic-ThemeCard-fake-progressbar__inner {
  position: absolute;
  top: 0; left: 0;
  width: 66%; height: 100%;
  border-top-left-radius: $baseBorderRadius - 1;
  border-bottom-left-radius: $baseBorderRadius - 1;
}

.ic-ThemeCard-fake-radio {
  width: 100%; height: 14px;
  position: relative;
  box-sizing: border-box;
  margin-bottom: 8px;
  &:after {
    content: "";
    box-sizing: border-box;
    position: absolute;
    right: 0; top: 50%;
    margin-top: -1px;
    height: 2px; width: calc(100% - 24px);
    background: $ic-border-light;
  }
}

.ic-ThemeCard-fake-radio__inner {
  box-sizing: border-box;
  border-radius: 100%;
  width: 14px; height: 14px;
  box-shadow: inset 0 0 0 2px $ic-color-light;
  border-width: 2px; border-style: solid;
}

.ic-ThemeCard-fake-checkbox {
  width: 100%; height: 14px;
  position: relative;
  box-sizing: border-box;
  &:after {
    content: "";
    box-sizing: border-box;
    position: absolute;
    right: 0; top: 50%;
    margin-top: -1px;
    height: 2px; width: calc(100% - 24px);
    background: $ic-border-light;
  }
}

.ic-ThemeCard-fake-checkbox__inner {
  box-sizing: border-box;
  border-radius: $baseBorderRadius;
  width: 14px; height: 14px;
  position: relative;
  @include overwrite-default-icon-size(8px);
  > i[class^=icon-] {
    color: $ic-color-light;
    position: absolute;
    top: 2px; left: 3px;
    line-height: 8px;
  }
}

.ic-ThemeCard-name-button {
  box-sizing: border-box;
  text-align: left;
  background: transparent;
  border: none;
  color: $ic-link-color;
  padding: 8px;
  display: block;
  max-width: 212px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;

  &:focus, &:hover {
    text-decoration: underline;
  }

  &:focus {
    outline: 1px solid $ic-link-color;
    outline-offset: -1px;
  }
}

.ic-ThemeCard-main {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  background: $ic-color-light;
  padding: 4px;
}

.ic-ThemeCard-main__name {
  box-sizing: border-box;
  flex: 1;
  padding-right: $ic-sp*1.5;
  min-width: 1px;
}

.ic-ThemeCard-main__actions {
  box-sizing: border-box;
  min-width: 1px;
  padding-right: 4px;
}

.ic-ThemeCard-status {
  padding: $ic-sp/2 $ic-sp;
  color: $ic-color-light;
  &.ic-ThemeCard-status--is-active-theme {
    padding: $ic-sp $ic-sp 8px $ic-sp; // taking off 4px for bottom border
    background: $ic-color-success;
  }
}

.ic-ThemeCard-overlay {
  transition: all 0.2s ease-out;
  position: absolute;
  top: 0; left: 0;
  z-index: 1;
  height: 100%; width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(black, 0.85);
  color: $ic-color-light;
}

.ic-ThemeCard-overlay__content {
  text-align: center;
  .Button {
    border-color: rgba(black, 0.65);
    margin: 0 2px;
  }
}

.ic-ThemeCard-overlay__heading {
  color: $ic-color-light;
  margin: 0 0 $ic-sp;
}

.ic-ThemeCard-overlay-transition-enter {
  opacity: 0;
  transform: scale(0.5);
}

.ic-ThemeCard-overlay-transition-enter.ic-ThemeCard-overlay-transition-enter-active {
  opacity: 1;
  transform: scale(1);
  transition-property: transform, opacity;
  transition-duration: 0.2s;
  transition-timing-function: ease-out;
}

.ic-ThemeCard-overlay-transition-leave {
  opacity: 1;
  transform: scale(1);
  transition-property: transform, opacity;
  transition-duration: 0.2s;
  transition-timing-function: ease-in;
}

.ic-ThemeCard-overlay-transition-leave.ic-ThemeCard-overlay-transition-leave-active {
  opacity: 0;
  transform: scale(0.5);
}
